﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using MiniStock.Client.UI.QueryService;

namespace MiniStock.Client.UI.Models
{
    public class CreateCustomerModel
    {
        [Required]
        public string Name { get; set; }

        public Guid? Id { get; set; }
    }

    public class ChangeAddressModel
    {
        public Guid? Id { get; set; }

        public string State { get; set; }
        public string City { get; set; }
        public string StreetName { get; set; }
        public string StreetNumber { get; set; }

        public ChangeAddressModel()
        {
        }

        public ChangeAddressModel(Customer c, Address a)
        {
            Id = c.Id;
            State = a.State;
            City = a.City;
            StreetName = a.StreetName;
            StreetNumber = a.StreetNumber;
        }

        public Address ToAddress()
        {
            return new Address()
                       {
                           City = this.City,
                           State = this.State,
                           StreetName = this.StreetName,
                           StreetNumber = this.StreetNumber
                       };
        }
    }

    public class ChangeContactPersonModel
    {
        public Guid? Id { get; set; }

        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Email { get; set; }
        public string Phone { get; set; }

        public ChangeContactPersonModel()
        {
        }

        public ChangeContactPersonModel(Customer c, ContactPerson p)
        {
            Id = c.Id;
            this.FirstName = p.FirstName;
            this.LastName = p.LastName;
            this.Email = p.Email;
            this.Phone = p.Phone;
        }

        public ContactPerson ToContactPerson()
        {
            return new ContactPerson()
                       {
                           FirstName = this.FirstName,
                           LastName = this.LastName,
                           Email = this.Email,
                           Phone = this.Phone,
                       };
        }


    }
}